package org.managarm.jmanaintlib.machine;

public abstract class VmExecutor {
	/* --------- mandatory operations ---------- */
	public abstract void pushArgument(VmCell argument);
	public abstract VmCode getCodeObject();
	public abstract boolean hasReturned() throws VmError;
	public abstract VmCell getReturn() throws VmError;
	
	// --------- optional operations ---------- */
	public boolean catchException(VmCell exception) throws VmError {
		return false;
	}
	public void processReturn(VmCell value) throws VmError {
		throw new VmError(getClass().getSimpleName()
				+ "processReturn(): Unsupported operation");
	}
	public void singleStep(VmState state) throws VmError {
		throw new VmError(getClass().getSimpleName()
				+ "singleStep(): Unsupported operation");
	}
}
